/*
 * Copyright (c) 2006-2009 by Abacus Research AG, Switzerland.
 * All rights reserved.
 *
 * This file is part of the Abacus Formula Compiler (AFC).
 *
 * For commercial licensing, please contact sales(at)formulacompiler.com.
 *
 * AFC is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AFC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AFC.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.formulacompiler.compiler;

import java.io.IOException;
import java.io.OutputStream;

import org.formulacompiler.runtime.Engine;


/**
 * Defines the {@link #saveTo(OutputStream)} method for engines returned by an engine compiler. This
 * allows you to save a compiled engine to persistent storage and then later re-instatiate it using
 * {@link org.formulacompiler.runtime.FormulaRuntime#loadEngine(java.io.InputStream)}.
 * <p>
 * The {@link org.formulacompiler.runtime.Engine} interface does not have save support so as not to
 * burden the run-time-only support with it.
 * <p>
 * <em>This interface is an API only. Do not implement it yourself.</em>
 * 
 * @author peo
 */
public interface SaveableEngine extends Engine
{

	/**
	 * Saves a compiled engine to a stream. You can later re-instantiate the engine from the stream
	 * using {@link org.formulacompiler.runtime.FormulaRuntime#loadEngine(java.io.InputStream)}. The
	 * engine is saved in the format of a compressed .jar file containing .class entries for all the
	 * classes generated by AFC.
	 * 
	 * @param _stream to save the engine to.
	 * @throws IOException
	 */
	public void saveTo( OutputStream _stream ) throws IOException;

}
